package com.cupk.service;


import com.cupk.mapper.CategoryMapper;
import com.cupk.pojo.Category;
import com.cupk.pojo.PageQueryUtil;
import com.cupk.pojo.PageResult;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Primary
public class CategoryServiceImpl implements CategoryService{
    @Resource
    private CategoryMapper categoryMapper;

    public CategoryServiceImpl(CategoryMapper categoryMapper) {
        this.categoryMapper = categoryMapper;
    }

    @Override
    public PageResult getBlogCategoryPage(PageQueryUtil pageUtil) {
        List<Category> categoryList = categoryMapper.findCategoryLIst(pageUtil);
        int total = categoryMapper.getTotalCategories(pageUtil);
        return new PageResult(categoryList, total, pageUtil.getLimit(), pageUtil.getPage());
    }

    @Override
    public Boolean saveCategory(String categoryName, String categoryIcon) {
        return null;
    }


}
